//
//  ContentView.swift
//  shop
//
//  Created by chen on 2025/5/12.
//

import SwiftUI

struct ContentView: View {
    
    @State private var selectTab: TabEnum
    
    init(selectTab: TabEnum = .home) {
        self.selectTab = selectTab
        UITabBar.appearance().backgroundColor = .white
    }
    
    var body: some View {
        TabView(selection: $selectTab){
            HomeView()
                .tabItem{
                    Image(systemName: selectTab == TabEnum.home ? "waveform.circle.fill" : "waveform.circle")
                    Text("每日推荐")
                }
                .tag(TabEnum.home)
            
            RankView()
                .tabItem{
                    Image(systemName: selectTab == TabEnum.rank ? "list.bullet.circle.fill" : "list.bullet.circle")
                    Text("热门榜单")
                }
                .tag(TabEnum.rank)
            
            BrandView()
                .tabItem{
                    Image(systemName: selectTab == TabEnum.brand ? "personalhotspot.circle.fill" : "personalhotspot.circle")
                    Text("品牌特卖")
                }
                .tag(TabEnum.brand)
            
            MineView(selectTab: $selectTab)
                .tabItem{
                    Image(systemName: selectTab == TabEnum.mine ? "person.crop.circle.fill" : "person.crop.circle")
                    Text("我的")
                }
                .tag(TabEnum.mine)
        }
        .tint(Color.red)
        .navigationBarBackButtonHidden(true)
    }
}

#Preview {
    ContentView()
}
